#include<stdio.h>
#include<string.h>

char * s_gets(char * st, int n) {
    char * ret_val;
    char * find;

    ret_val = fgets(st, n, stdin);
    if (ret_val) {
        // look for newline
        find = strchr(st, '\n');
        // if the address is not NULL
        if (find) {
            *find = '\0';
        } else{
            while (getchar() != '\n') {
                continue;       // dispose of rest of line
            }
        }
    }
    return ret_val;
}